<template>
	<view class="container">
		<view class="title">{{new Date().getFullYear()}}年{{new Date().getMonth()+1}}月低保查询</view>
		<text class="tips">请输入您要查询的身份证号</text>
		<input class="card-input" @input="onKeycardId" placeholder="身份证号码" />
		<button type="primary" @click="query" class="queryBut" :loading="loading">查询</button>
	</view>
</template>

<script>
	import { formatDate } from '@/utils/date.js'
	export default {
		data() {
			return {
				loading:false,
				cardId: ''
			};
		},
		onLoad() {
		},
		methods: {
			query () {
				this.loading = true
				this.$http.get('GetLMVER', {params: {LD_ID: this.cardId, YM: formatDate(new Date(),'yyyy-MM')}}).then(res => {
					console.log(res.data)
					if (res.error_code == '-1') {
						uni.showToast({
							title: '查询为空',
							duration: 2000,
							icon: 'none'
						});
					} else {
						if (res.data.STEPSTATE=='不同意') {
							uni.navigateTo({
								url: 'queryfail?data=' + encodeURIComponent(JSON.stringify(res.data))
							})
						} else {
							uni.navigateTo({
								url: 'queryResult?data=' + encodeURIComponent(JSON.stringify(res.data))
							})
						}
					}
					this.loading = false
				}).catch(err => {
				})
			},
			onKeycardId (event) {
				this.cardId = event.target.value
			}
		}
	}
</script>

<style lang="scss">
.container {
	padding: 0 76upx;
	.title{
		font-size: 44upx;
		font-weight: 500;
		display: block;
		padding: 40upx 0;
		text-align: center;
	}
	.tips{
		padding: 16upx 0;
		display: inline-block;
		font-size: 32upx;
		color: #101010;
	}
	.card-input{
		border: none;
		border: solid 4upx #7A7A7A;
		width: 100%;
		box-sizing: border-box;
		height: 80upx;
		padding: 0 20upx;
		font-size: 32upx;
		box-sizing: border-box;
		margin-bottom: 40upx;
	}
	.queryBut{
		border: none;
		background-color: #1EC88B;
		color: #fff;
		font-size: 36upx;
		font-weight: 500;
		text-align: center;
		border-radius: 10upx;
		height: 94upx;
		line-height: 94upx;
	}
}
</style>
